import {
    reqsecklist,
    reqseckinfo,
    reqseckadd,
} from "../../request/api.js"
const state = {
    info: {
        isshow: false,
        isadd: true
    },
    reqpage: {
        size: 5,
        page: 1
    },
    secklist: [],
    seckinfo: [],
}
const getters = {
    info(state) {
        return state.info
    },
    secklist(state) {
        return state.secklist
    },
    seckinfo(state) {
        return state.seckinfo
    },
}
const mutations = {
    changeinfo(state, data) {
        state.info = data
    },
    secklist(state, data) {
        state.secklist = data
    },
    seckinfo(state, data) {
        state.seckinfo = data
    },

}
const actions = {
    secklist(context) {
        reqsecklist(context.state.reqpage).then(res => {
            context.commit("secklist", res.data.list)
        })
    },
    seckinfo(context, data) {
        reqseckinfo(data).then(res => {
            res.data.list.id = data.id
            context.commit("seckinfo", res.data.list)
        })
    },
    seckadd(context, data){
        reqseckadd().then(res=>{
            
        })
    },
}
export default {
    state,
    getters,
    mutations,
    actions,
    namespaced: true
}